home *** CD-ROM | disk | FTP | other *** search
/ Gekikoh Dennoh Club 7 / Gekikoh Dennoh Club Vol. 7 (Japan).7z / Gekikoh Dennoh Club Vol. 7 (Japan) (Track 01).bin / games / otoko / source.lzh / entry.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-14  |  2.7 KB  |  146 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "otoko.h"
  4. #include "player.h"
  5. #include "enemy.h"
  6. #include "entry.h"
  7. #include "gvram.h"
  8. #include "sound.h"
  9.  
  10. #ifdef DEBUG
  11. #include "txfont.h"
  12. #endif
  13.  
  14. #define ENTRY_MUSIC    250
  15. #define ENTRY_MUSIC_FADEOUT    251
  16. #define ENTRY_NON    253
  17. #define ENTRY_START    254
  18. #define ENTRY_END    255
  19.  
  20.  
  21. enum {
  22.     WAIT_NON = 0, WAIT_NOW, WAIT_END
  23. };
  24.  
  25. static unsigned char entry_control_wait;    /* =!0:entry_control が 0 になるまで待つ */
  26.  
  27.  
  28.  
  29. void EntryInit0 (void)
  30. {
  31. }
  32.  
  33.  
  34.  
  35. /* ゲーム開始時に呼ばれる */
  36. void EntryInit (void)
  37. {
  38.     entry_counter = 0;
  39.     entry_timer = 0;
  40.     entry_counter_stop = 0;
  41.     entry_control = 0;
  42.     entry_control_wait = WAIT_NON;
  43. }
  44.  
  45.  
  46.  
  47. void EntryMove (void)
  48. {
  49. #ifdef DEBUG
  50.     {
  51.         char temp_str[64];
  52.         sprintf (temp_str, "FRM %06d", player->replay_counter);
  53.         TxfontCursor (21, 6);
  54.         TxfontPuts (temp_str);
  55.     }
  56. #endif
  57.  
  58.     if (entry_control_wait == WAIT_NOW) {
  59.         if (entry_control == 0) {
  60.             entry_counter_stop = 0;
  61.             entry_control_wait = WAIT_END;
  62.         }
  63.     }
  64.     if (entry_counter_stop)
  65.         return;        /* エントリーカウンター停止中 */
  66.     if (--entry_timer > 0)
  67.         return;        /* まだ敵は出現しない */
  68.  
  69. #ifdef DEBUG
  70.     {
  71.         char temp_str[64];
  72.         sprintf (temp_str, "ENTRY %03d", entry_counter);
  73.         TxfontCursor (22, 5);
  74.         TxfontPuts (temp_str);
  75.     }
  76. #endif
  77.  
  78.     do {
  79.         short type = stage_data[stage][entry_counter].type;
  80.         entry_timer = stage_data[stage][entry_counter].timer;
  81.  
  82.         switch (type) {
  83.         case ENTRY_START:
  84.             GvramInit ();
  85.             bg_contrast_num = 33;
  86.             entry_counter++;
  87.             break;
  88.  
  89.         case ENTRY_END:
  90.             /* ここで停止されたエントリーカウンターは otoko.c VdispRoutine() で */
  91.             /* フェードアウトが終わると再開される */
  92.             entry_counter_stop = !0;    /* エントリーカウンター停止 */
  93.             bg_contrast_control = BG_FADEOUT;
  94.             bg_contrast_num = 33;
  95.             if (stage < STAGES - 1) {
  96.                 stage++;
  97.                 entry_counter = 0;
  98.                 entry_timer = 1;
  99.             } else {
  100.                 entry_counter++;
  101.                 entry_timer = 1;
  102.             }
  103.             break;
  104.  
  105.         case ENTRY_NON:
  106.             entry_counter++;
  107.             break;
  108.  
  109.         case ENTRY_MUSIC:
  110.             SoundMusic (stage_data[stage][entry_counter].arg);
  111.             entry_counter++;
  112.             break;
  113.  
  114.         case ENTRY_MUSIC_FADEOUT:
  115.             SoundFadeOut (stage_data[stage][entry_counter].arg);
  116.             entry_counter++;
  117.             break;
  118.  
  119.         default:
  120.             /* control = 0 の時は entry_control が 0 になるまで待つ */
  121.             if (entry_control_wait == WAIT_NON) {
  122.                 if (stage_data[stage][entry_counter].control == 0) {
  123.                     entry_counter_stop = !0;
  124.                     entry_control_wait = WAIT_NOW;
  125.                     break;
  126.                 }
  127.             } else {
  128.                 entry_control_wait = WAIT_NON;
  129.             }
  130.             if (entry_control <= stage_data[stage][entry_counter].control) {
  131.                 EnemyInit (type,
  132.                        stage_data[stage][entry_counter].x, stage_data[stage][entry_counter].y,
  133.                    stage_data[stage][entry_counter].arg, (struct _enemy *) 0);
  134.             }
  135.             entry_counter++;
  136.             break;
  137.         }
  138.     } while (entry_timer == 0);
  139. }
  140.  
  141.  
  142.  
  143. void EntryTini (void)
  144. {
  145. }
  146.